//
//  DHSubtitleView.m
//  DHKuaiYi
//
//  Created by 韩旭 on 16/11/13.
//  Copyright © 2016年 30-陈辉华. All rights reserved.
//

#import "DHSubtitleView.h"
#import "Masonry.h"

@implementation DHSubtitleView

- (void)xhhSetupSubviews {
    
    [super xhhSetupSubviews];
    [self setupUI];
    
}
-(void)setupUI {
    
    //左侧图片
    UIImageView *imgSub = [[UIImageView alloc]init];
    self.imgSub = imgSub;
    imgSub.image=[UIImage imageNamed:@"ic_fack_keyboard_btn_send.jpg"];
    
    /*---------- 屏幕适配计算 ----------*/
    //计算比例
    CGFloat sOne = (float)6 / 375;
    CGFloat sSix = (float)12 / 375;
    CGFloat sEight = (float)15 / 375;
    
    CGFloat sTwo = (float)20 / 667;
    CGFloat sSeven = (float)12 / 667;
    
    //margin
    CGFloat sOneMargin = sOne * viewWidth;
    CGFloat sSixMargin = sSix * viewWidth;
    CGFloat sEightMargin = sEight * viewWidth;
    
    CGFloat sTwoMargin = sTwo * viewHeight;
    CGFloat sSevenMargin = sSeven * viewHeight;
    
    CGSize imgSize = CGSizeMake(sOneMargin, sTwoMargin);
    [self addSubview:imgSub];
    
    //左侧label
    UILabel *labelLeft = [[UILabel alloc]init];
    self.labelLeft= labelLeft;
    labelLeft.text = @"名医通";
    labelLeft.font=[UIFont systemFontOfSize:sEightMargin];
    labelLeft.textColor = [UIColor XHH_colorWithHex:0x000000];
    [self addSubview:labelLeft];
    
    //自动布局
    [imgSub mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(sSevenMargin);
        make.left.mas_equalTo(self).offset(sSixMargin);
        make.size.mas_equalTo(imgSize);
    }];
    
    [labelLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self).offset(sSevenMargin);
        make.left.mas_equalTo(imgSub).offset(sSixMargin);
    }];
}
@end
